package com.yehun.utils;

/**
 * Created by Genius on 2017/3/27 0027.
 */
public class ExceptionUtils {

    public static String getExceptionAllinformation(Exception ex) {
        StackTraceElement[] traces = ex.getStackTrace();
        if (traces != null && traces.length > 0) {
            StringBuilder string = new StringBuilder();
            string.append(ex.toString()).append("\r\n");
            for (StackTraceElement trace : traces) {
                //System.out.println(String.format("\tat %s", trace));
                string.append(String.format("\tat %s\r\n", trace));
            }
            return string.toString();
        }
        return null;
    }

}